title: Is this key-oriented access-protection pattern a known idiom?
body: <p><a href="https://stackoverflow.com/users/147192/matthieu-m">Matthieu M.</a> brought up a pattern for access-protection in <a href="https://stackoverflow.com/questions/3217390/clean-c-granular-friend-equivalent-and-rationale-behind-friend/3218920#3218920">this answer</a> that i'd seen before, but never conciously considered a pattern:</p>
  
  <pre><code>class SomeKey { 
      friend class Foo;
      SomeKey() {} 
      // possibly make it non-copyable too
  };
  
  class Bar {
  public:
      void protectedMethod(SomeKey);
  };
  </code></pre>
  
  <p>Here only a <code>friend</code> of the key class has access to <code>protectedMethod()</code>:</p>
  
  <pre><code>class Foo {
      void do_stuff(Bar&amp; b) { 
          b.protectedMethod(SomeKey()); // fine, Foo is friend of SomeKey
      }
  };
  
  class Baz {
      void do_stuff(Bar&amp; b) {
          b.protectedMethod(SomeKey()); // error, SomeKey::SomeKey() is private
      }
  };
  </code></pre>
  
  <p>It allows more fine-granular access-control than making <code>Foo</code> a <code>friend</code> of <code>Bar</code> and avoids more complicated proxying patterns.</p>
  
  <p>Does anyone know whether this approach already has a name, i.e., is a known pattern?</p>