clean C++ granular friend equivalent? (Answer: Attorney-Client Idiom)
There is a very simple pattern, which has retro-actively been dubbed PassKey, and which is very easy in C++11: template <typename T> class Key { friend T; Key() {} Key(Key const&) {} }; And with that: class Foo; class Bar { public: void special(int a, Key<Foo>); }; And the call site, in any Foo method, … Read more