Lets say you have a FooManager
made to manage multiple objects of type Foo
. The FooManager
needs to see some parts of its Foo
s to evaluate their current state. Before I was using a few accessors in Foo
to see these parts, until I realized that FooManager
is the only class actually using these. I decided to make FooManager
a friend of Foo
. This resulted in most of class Foo
becoming private.
Is this an appropriate use of friend? My reasoning was that it helps encapsulation because while it gives FooManager
complete access to Foo
's internals, it completely blocks off access to everything else.