title: Friend protected method in c++
body: <p>I've got a class Foo that must be accessed "directly" in other class Bar. I'd like to build a little framework declaring the method of Bar (which is the friend method of Foo) protected. In this way I could build several classes children of Bar. </p>
  
  <p>Gcc complains about that and it works only if the method is public.</p>
  
  <p>How can I do? Example of my code:</p>
  
  <pre><code>class Foo;
  class Bar {
      protected:
          float* internal(Foo&amp; f);
  };
  class Foo {
      private:
          //some data
      public:
          //some methods
          friend float* Bar::internal(Foo&amp; f);
  };
  </code></pre>
  
  <p>Gcc message:</p>
  
  <pre><code>prog.cpp:4:16: error: ‘float* Bar::internal(Foo&amp;)’ is protected
           float* internal(Foo&amp; f);
                  ^
  prog.cpp:11:43: error: within this context
           friend float* Bar::internal(Foo&amp; f);
                                             ^
  </code></pre>