title: friend function using template classes c++
body: <p>I made a class which has a friend function and when I declare it there are no problems but, when I write its code it returns me the error:</p>
  <p>&quot;Out-of-line definition of 'change' does not match any declaration in 'MyClass '&quot;.</p>
  <p>Here's the code</p>
  <pre><code>template &lt;class T&gt;
  class MyClass {
  private:
      T a;
      
  public:
      MyClass(T);
      ~MyClass();
      friend void change(MyClass);
  };
  
  template &lt;class T&gt;
  MyClass &lt;T&gt; :: MyClass(T value) {
      a = value;
  }
  
  template &lt;class T&gt;
  MyClass &lt;T&gt; :: ~MyClass() {}
  
  template &lt;class T&gt;
  void MyClass &lt;T&gt; :: change(MyClass class) { //Out-of-line definition of 'change' does not match any declaration in 'MyClass &lt;T&gt;'
      a = class.a;
  }
  </code></pre>