title: no instance of constructor matches the argument list -- argument types are:
body: <p>I am getting <code>no instance of constructor "MyClass&lt;t&gt;::MyClass [with t=double]" matches the argument list -- argument types are: (MyClass&lt;int&gt;)</code>.</p>
  
  <p>I just want to copy one object's value into another.
  It work fine without template syntax.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  template&lt;class t&gt;
  class MyClass{
    t x,z;
    public:
      MyClass(){}
      MyClass (const t a,const t b):x(a),z(b) {
      }
  
      MyClass(const MyClass&amp; obj){
          x=(t) obj.x;
          z=(t)obj.z;
      }
  
      // access content:
      void  content()  {
          cout&lt;&lt;x&lt;&lt;z&lt;&lt;endl;
  
      }
  };
  
  
  int main () {
    MyClass&lt;int&gt; foo(34,23);
    MyClass &lt;double&gt; bar(foo);
  
    bar.content();
    foo.content();
  
    return 0;
  }
  </code></pre>
  
  <p>I have searched so many questions/answers related to it but i don't find solution</p>