title: Access on base class of template prior to expansion of the template being derived from
body: <p>I'm trying to publicly derive a class from a template that will make it inherit from a base class and get access on protected members.  But before the template is expanded it doesn't have those rights, so it can't use a Base member as a template parameter:</p>
  
  <pre><code>using Fun = void (*)();
  
  class Base {
  protected:
      // friend class Derived; // ...need this to eliminate complaint
      static void something();
  };
  
  template&lt;Fun F&gt;
  class Variant : public Base {};
  
  class Derived : public Variant&lt;&amp;Base::something&gt; { // `something()` is protected
  public:
      void somethingElse() {
          something(); // doesn't complain about this `something()`
      }
  };
  
  int main() {}
  </code></pre>
  
  <p>The weird bit about this to me was that friending it worked at all.  I wondered if I might "sneak Derived in the door" by putting a public virtual inheritance from Base before the Variant:</p>
  
  <pre><code>class Derived : public virtual Base, public Variant&lt;&amp;Base::something&gt;
  </code></pre>
  
  <p>That didn't help.</p>
  
  <p><strong>Question:</strong> is there some other trick for avoiding explicit mention of all derived classes in Base, yet still have access to pick protected members out of it for template parameters?</p>
  
  <p><em>(Note: Trying this on an older gcc, 4.6.3, looks like even the friending doesn't help in that case.  So it seems support for that is somewhat new.)</em></p>