@roo: Encapsulation is not broken here because the class itself dictates who can access its private members. Encapsulation would only be broken if this could be caused from outside the class, e.g. if your operator <<
would proclaim “I'm a friend of class foo
.”
friend
replaces use of public
, not use of private
!
Actually, the C++ FAQ answers this already.