------- Comment #4 from pinskia at gcc dot gnu dot org 2006-12-18 20:25 ------- (In reply to comment #3) > C++ standard §11.4 (Friends) ¶7: > > "A name nominated by a friend declaration shall be accessible in the scope of > the class containing the friend declaration. The meaning of the friend > declaration is the same whether the friend declaration appears in the private, > protected or public (9.2) portion of the class member-specification."
There is nothing about injecting the friend into the namespace there. All that is saying is the friend needs be accessible in that you cannot make a private method of another class a friend. In that, this is invalid code: class a { void f(void); public: void g(void); }; class b { friend void a::f(void); }; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30248