http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51584
Bug #: 51584 Summary: Errorneous compilation when deriving from an inaccessible friend class. Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: prasoonsaurav....@gmail.com struct A { private: class face; friend class face; }; struct A::face {}; template <typename _CharT> struct C : public A::face {}; int main() { C<int> x; } gets compiled on g++ 4.6.1. It shouldn't because "A name nominated by a friend declaration shall be accessible in the scope of the class containing the friend declaration" [11.4.7] A::face is inaccessible at the point of derivation. Comeau issues an error message.