title: Class has no suitable copy constructor, no binary operator '=' found,
body: <p>To put it simply, my compiler refuses to call the <strong>copy constructor</strong> and the <strong>assignment operator which I provided</strong>.
  I had a project for university to make a database-like program in C++ using architecture stratification(domain, repository, service and UI). Initially I was asked to use <code>std::vector</code> and I completed the program without any struggle. But now I have to replace <code>std::vector</code> with... a <strong>simply linked list</strong>
  I've pretty much finished writing the linked list and <strong>I've tested all of its functionalities</strong>. However, when I implement it in the program, replacing the <code>std::vector</code>, the compiler won't recognize the copy constructor and the assignment operator!
  Here is part of the Linked List implementation(without the <code>Node</code> class and <code>ForwardIterator</code> class which I've tested and don't seem to cause any issues)</p>
  
  <pre><code>template &lt;class ElemType&gt;
  class LinkedList
  {
      Node&lt;ElemType&gt; *front, *back;
  
  public:
  
      LinkedList() : front{ NULL }, back{ NULL } {}
  
      //The problematic copy constructor
      LinkedList(LinkedList&lt;ElemType&gt;&amp; lst) : LinkedList() {
          for (auto&amp; elem : lst)
              push_back(elem);
      }
  
      ~LinkedList() {
          while (front != NULL)
              erase(begin());
      }
  
      //The problematic assignment operator
      LinkedList&lt;ElemType&gt;&amp; operator=(LinkedList&lt;ElemType&gt;&amp; lst) {
      while (front != NULL)
          erase(begin());
      for (auto&amp; elem : lst)
          push_back(elem);
      return *this;
      }
  </code></pre>
  
  <p>I get the following errors multiple times:</p>
  
  <blockquote>
    <p>E0334 class "LinkedList&lt; Medicament >" has no suitable copy constructor</p>
    
    <p>E0349 no operator "=" matches these operands</p>
    
    <p>C2440    'initializing': cannot convert from 'LinkedList&lt; Medicament >' to
    'LinkedList&lt; Medicament >'</p>
    
    <p>C2679    binary '=': no operator found which takes a right-hand operand
    of type 'LinkedList&lt; Medicament >' (or there is no acceptable
    conversion)</p>
  </blockquote>
  
  <p>I would normally make the parameters and auto's <code>const</code>, but that gives me another error(no idea why), despite <code>push_back()</code> taking a const reference:</p>
  
  <blockquote>
    <p>C2662 'ForwardIterator&lt; Medicament > LinkedList&lt; Medicament >::begin(void)': cannot convert 'this' pointer from 'const LinkedList&lt; Medicament >' to 'LinkedList&lt; Medicament > &amp;'</p>
  </blockquote>
  
  <p>The main errors(copy constructor and assignment) only happen when I pass the argument as a return value of a member function from within the service/repository/ui . A short example that causes this issue:</p>
  
  <pre><code>class MediRepo {                                    //repository
  
  public:
      LinkedList&lt;Medicament&gt; elem;                    //I made it public for now
  
  //............
  
      //Returns a copy of the medicine list
      LinkedList&lt;Medicament&gt; getMeds() { return elem; }
  }
  
  //main
  MediRepo rep;
  LinkedList&lt;Medicament&gt; medlist{ rep.getMeds() };    //ERROR E0334 and C2440
  LinkedList&lt;Medicament&gt; medlist{ rep.elem };         //OK
  </code></pre>
  
  <p>Like I said, the linked lists(including the constructor and the assignment operator) work perfectly fine outside of the service/repository. If I spend more time, I can probably come up with a half-assed workaround to this, but I hope somebody can tell me what I am doing wrong that gives me these errors(the one with const parameters, too, if possible). I've spent way too many hours trying to solve this...
  Also, please ask if you would like to see more of the source code. </p>