http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32204
--- Comment #8 from etherice <scottbaldwin at gmail dot com> 2012-10-27 08:52:10 UTC --- In MSVC's defense, the standard is vague (or insufficient) in this regard for 'friend class' declarations. It says: "If a friend declaration appears in a local class (9.8) and the name specified is an unqualified name, a prior declaration is looked up without considering scopes that are outside the innermost enclosing non-class scope." ... "For a friend class declaration, if there is no prior declaration, the class that is specified belongs to the innermost enclosing non-class scope, but if it is subsequently referenced, its name is not found by name lookup until a matching declaration is provided in the innermost enclosing nonclass scope." The standard *should* specify whether the 'friend class declaration' case applies to qualified names. For example: namespace ns { class NSClass { friend class ::SomeGlobalClass; }; } Since ::SomeGlobalClass is qualified (via scope resolution operator) it explicitly belongs to the global namespace. However, the standard says that it shall "belong to the innermost enclosing non-class scope", which is a contradiction (or nonsense). This is why the standard *should* specify a case for qualified vs unqualified names in friend class declarations (as it does for normal friend declarations). The assumption MSVC makes not only seems reasonable, but is also convenient for developers as it allows *hidden* forward declarations of names in outer namespaces. This avoids having to make an unnecessary explicit forward declaration. Perhaps GCC should "interpret" this part of the standard similarly.