title: Operator Overloading in class template
body: <p>Looking to implement a cross-product operator^ oveload for template Vector3D class ideally that overload (though I think highly improbable/impossible) should be able to receive two different parameter types and return a third s.t.</p>
  <pre><code>    Vector3D&lt;Distance&gt; r;
      Vector3D&lt;Force&gt; F;
      Vector3D&lt;Moment&gt; M = r^F;
  </code></pre>
  <p>Since I assume that this is impossible and/or improbable I would be open to forcing the return parameter type to double s.t.</p>
  <pre><code>    Vector3D&lt;Distance&gt; r;
      Vector3D&lt;Force&gt; F;
      Vector3D&lt;double&gt; M = r^F;
  </code></pre>
  <p>However when I do that in the code below I get the following linking error even though template class Vector3D is instantiated:</p>
  <pre><code>1&gt;Source.obj : error LNK2019: unresolved external symbol &quot;public: class 
    Vector3D&lt;double&gt; const __thiscall Vector3D&lt;double&gt;::operator^&lt;double&gt;(class 
    Vector3D&lt;double&gt; const &amp;)const &quot; (??$?TN@?$Vector3D@N@@QBE?
  </code></pre>
  <p>Thank you in advance for the help.</p>
  <pre><code>    //Vector3D.h
      template &lt;typename T&gt;
      class Vector3D
      {
      public:
      '''
      template &lt;typename Arg&gt;
      const Vector3D&lt;double&gt; operator^ (const Vector3D&lt;Arg&gt;&amp; p_other) const;
      '''
      private:
      //////////////////////////////////////////////////////////////////////////
      // *** PRIVATE DATA MEMBERS ***
      //////////////////////////////////////////////////////////////////////////
      T m_elem[3];
  
      }
  
      //Vector3D.cpp
      /// Calculate the cross product
      //
      template &lt;typename T&gt;
      template &lt;typename Arg&gt;
      const Vector3D&lt;double&gt; Vector3D&lt;T&gt;::operator^ (const Vector3D&lt;Arg&gt;&amp; p_right) const
      {
          // Local variables
          Vector3D&lt;T&gt; left(*this);
          Vector3D&lt;double&gt; cross_product;
          // Calculation
          cross_product.m_elem[0] = left.m_elem[1] * p_right.m_elem[2] - left.m_elem[2] * p_right.m_elem[1];
          cross_product.m_elem[1] = left.m_elem[2] * p_right.m_elem[0] - left.m_elem[0] * p_right.m_elem[2];
          cross_product.m_elem[2] = left.m_elem[0] * p_right.m_elem[1] - left.m_elem[1] * p_right.m_elem[0];
  
          return cross_product;
      }
  
      template class Vector3D&lt;double&gt;;
  </code></pre>