http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58263
--- Comment #2 from vova7890 <vova7890 at mail dot ru> --- (In reply to Jonathan Wakely from comment #1) > Do we warn in A.cc that B is not defined? It is defined in another header, > but that isn't included by A.cc because it isn't needed. We warn about implicit friend class MyClas2. For example, we wrong writed class name(as in example MyClas2 -> MyClass2, missed the letter "s" in the word Class), try to compile that and see: [vova7890@localhost tmp]$ g++ -O2 main.cpp main.cpp: In member function 'void MyClass2::need(MyClass1*)': main.cpp:10:9: error: 'void MyClass1::help()' is private void help(); ^ main.cpp:18:16: error: within this context cl->help(); // error: is private!! But, we don`t understand why it`s private, because we think that we correctly writed class name(friend class MyClass2), and do not see where is the bug exactly. But, if compiler say as, about implicit friend class MyClas2, like this: [vova7890@localhost tmp]$ g++ -O2 main.cpp main.cpp:8:12: warning: implicit declaration of friend 'MyClas2' friend class MyClas2; ^ main.cpp: In member function 'void MyClass2::need(MyClass1*)': main.cpp:10:9: error: 'void MyClass1::help()' is private void help(); ^ main.cpp:18:16: error: within this context cl->help(); // error: is private!! we see where is exactly issue, and just correct that stupid typo.