title: My template class method returns bad type?
body: <p>The template class method <strong>return_self</strong> must return a object of type <code>Class&lt;string&gt;</code>
  . But, it returns <code>Class&lt;basic_string&lt;char&gt;&gt;</code></p>
  <p>Why, please check out my code</p>
  <pre><code>using namespace std;
  
  template &lt;typename Type&gt;
  struct Class;
  
  template &lt;typename Type&gt;
  ostream&amp; operator&lt;&lt;(ostream&amp; os, Class&lt;Type&gt;&amp; ref){
      os &lt;&lt; ref.value;
      return os;
  }
  
  template &lt;typename Type&gt;
  struct Class{
      Type value;
      
      Class(Type val): value{val}{}
      
      // Returns bad Type
      Class&lt;Type&gt; return_self(){
          return *this;
      }
  
      friend ostream&amp; operator&lt;&lt;&lt;Type&gt;(ostream&amp;, Class&lt;Type&gt;&amp;);
  };
  
  int main(){
      Class&lt;string&gt; obj{&quot;How are you&quot;};
      
      cout &lt;&lt; obj &lt;&lt; endl; // This one works fine
      
      cout &lt;&lt; obj.return_self() &lt;&lt; endl; // Error occurs here
  }
  
  
  </code></pre>