title: Why can't I have template and default arguments?
body: <p>I changed a paremeter in a function to accept any kind of object using a template but I can't use it in conjunction with other default parameters, is there something I am missing?</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  
  class MyClass {
      public:
      std::wstring msg = L"hey";
      MyClass(){};
  };
  
  class MyClass2{
      public:
      template&lt;class T&gt; MyClass2(T* t, int i);
  };
  template&lt;class T&gt;
  MyClass2::MyClass2(T* t,int i=0){ std::wcout &lt;&lt; t-&gt;msg &lt;&lt; std::endl; }
  
  int main(int argc, char **argv)
  {
      MyClass mc;
      MyClass2 mc2(&amp;mc);
      return 0;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>practice.cpp:16:32: error: redeclaration of 'MyClass2::MyClass2(T*, int)' may not have default arguments [-fpermissive]
  </code></pre>
  
  <p>I thought it was reasonable to not use default values in the template but is there a reason for the other parameters?</p>