Is this key-oriented access-protection pattern a known idiom?
Matthieu M. brought up a pattern for access-protection in this answer that i'd seen before, but never conciously considered a pattern: class SomeKey { friend class Foo; SomeKey() {} // possibly make it non-copyable too }; class Bar { public: void protectedMethod(SomeKey); }; Here only a friend of the key class has access to protectedMethod() : class Foo { void do_stuff(Bar& b) { b.protectedMethod(SomeKey()); // fine, Foo is friend of SomeKey } }; class Baz { void do_stuff(Bar& b) { b.protectedMethod(SomeKey()); // error, SomeKey::SomeKey() is private } }; It allows more fine-granular access