No Matching Function Call in a template class
<p>I'm writing a program that reads in a text file and stores data into a class of objects called User. I then store the User objects into a templated class of dynamic arrays called MyList with a push_back function.</p>

<p>currently my MyList class looks like this</p>

<pre><code>#ifndef MYLIST_H
#define MYLIST_H
#include &lt;string&gt;
#include &lt;vector&gt;

using namespace std;

template&lt;class type&gt;
class MyList
{
public:
  MyList(); 
  ~MyList(); 
  int size() const;
  int at(int) const;
  void remove(int);
  void push_back(type);

private:
  type* List;
  int _size;
  int _capacity;
  const static int CAPACITY = 80;
};
</code></pre>

<p>and the function to pushback looks like this </p>

<pre><code>template&lt;class type&gt;
void MyList&lt;type&gt;::push_back(type newfriend)
{

    if( _size &gt;= _capacity){
         _capacity++;

    List[_size] = newfriend;
        size++;
    }
}
</code></pre>

<p>My User class is as follows</p>

<pre><code>#ifndef USER_H
#define USER_H
#include "mylist.h"
#include &lt;string&gt;
#include &lt;vector&gt;   

using namespace std;

class User
{
public:
  User();
  User(int id, string name, int year, int zip);
  ~User();

private:
  int id;
  string name;
  int age;
  int zip;
  MyList &lt;int&gt; friends;
};

#endif
</code></pre>

<p>finally, in my main function I declare the user MyList like this</p>

<pre><code>MyList&lt;User&gt; object4;
</code></pre>

<p>and my call to push_back is as follows</p>

<pre><code>User newuser(int id, string name, int age, int zip);
   object4.push_back(newuser);
</code></pre>

<p>All the data in the User class is valid,</p>

<p>currently im getting an error "no matching function for call to 'MyList::push_back(User) (&amp;) (int, std:string, int, int)"</p>

<p>"note candidates are : void MyList::push_back(type) [with type = User]" </p>
