title: How do I declare this templated class function as a friend?
body: <p>Templates are making things so hard. I haven't got the syntax right, I've been trying for ages. I have a function called &quot;createSphere&quot; in a class called &quot;ModelMngr&quot; that I would like to be a friend of another class.</p>
  <pre><code>class ModelMngr
  {public:
  template &lt;typename T_scalar&gt;
      static Sphere&lt;T_scalar&gt;* createSphere(T_scalar radius, int sides, int heightSegments, const String&amp; name = &quot;Sphere Primitive Mesh&quot;);
  }
  
  template &lt;typename T_scalar&gt;
  class Sphere : public MeshBaseClass&lt;T_scalar&gt;
  {public:
          template &lt;typename T&gt; friend Sphere&lt;T&gt;* ModelMngr::createSphere(T radius, int sides, int heightSegments, const String&amp; name = &quot;Sphere Primitive Mesh&quot;);
  
  
  }
  </code></pre>
  <p>I changed the T_scalar in the friend declaration to T because I was worried there would be a name conflict with the template argument of the enclosing class. Is there any conflict?</p>