http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58054
--- Comment #2 from Evgeniy Dushistov <dushistov at mail dot ru> --- Yes, for C++ 2003 this is invalid code(page 212): class A { class B { }; friend class X; }; class X : A::B { // ill-formed: A::B cannot be accessed // in the base-clause for X A::B mx; // OK: A::B used to declare member of X class Y : A::B { // OK: A::B used to declare member of X A::B my; // ill-formed: A::B cannot be accessed // to declare members of nested class of X }; }; but for 2011 they looks like change behaviour.