title: Implementing a member function of a class nested in a template class
body: <p>I'm implementing template member functions in a .cpp, and understand the limitations involved (only going to template this class to one type at a time).  Everything is working fine, except this one case.  While I have gotten constructors for nested classes to work, I'm having trouble with any other nested class member function.  For reference, I'm compiling with VC++ 11.</p>
  
  <p>In .h:</p>
  
  <pre><code>template&lt;typename T&gt; class TemplateClass
  {
   class NestedClass
   {
    NestedClass();
  
    bool operator&lt;(const NestedClass&amp; rhs) const;
   };
  };
  </code></pre>
  
  <p>In .cpp:</p>
  
  <pre><code>//this compiles fine:
  template&lt;typename T&gt;
  TemplateClass&lt;T&gt;::NestedClass::NestedClass()
  {
   //do stuff here
  }
  
  //this won't compile:
  template&lt;typename T&gt;
  bool TemplateClass&lt;T&gt;::NestedClass::operator&lt;(const TemplateClass&lt;T&gt;::NestedClass&amp; rhs) const
  {
   //do stuff here
  
   return true;
  }
  
  template class TemplateClass&lt;int&gt;; //only using int specialization
  </code></pre>
  
  <p>edit:  Here's the errors, all pointing to the <code>operator&lt;</code> implementation line</p>
  
  <p>error C2059: syntax error : 'const'<br>
  error C2065: 'rhs' : undeclared identifier<br>
  error C2072: 'TemplateClass::NestedClass::operator &lt;' : initialization of a function<br>
  error C2470: 'TemplateClass::NestedClass::operator &lt;' : looks like a function definition, but there is no parameter list; skipping apparent body<br>
  error C2988: unrecognizable template declaration/definition    </p>