title: No viable overloaded '=' error even when I overloaded the assignment
body: <p>Almost the exact questions have been asked but I do not think mine is very similar. I will explain below the code:</p>
  
  <pre><code>class Person{
  public:
      string name;
      int age, height, weight;
  
      Person(string name = "empty", int age = 0, int height = 0, int weight = 0) {
          this-&gt;name = name;
          this-&gt;age = age;
          this-&gt;height = height;
          this-&gt;weight = weight;
      }
      void operator = (const Person &amp;P){
          name = P.name;
          age = P.age;
          height = P.height;
          weight = P.weight;
      }
  
      friend ostream&amp; operator&lt;&lt;(ostream&amp; os, const Person&amp; p);
  };
  
  class Stack{
  public:
      int top;
      Person* A;
      int size;
  
      Stack(int s){
          top = -1;
          size = s;
          A = new Person[size];
      }
  
      bool isEmpty(){
          if(top == -1)
              return true;
          else
              return false;
      }
      bool isFull(){
          if(top &gt;= size-1)
              return true;
          else
              return false;
      }
      void Push(Person* P){
          if(isFull()){
              cout &lt;&lt; "No Space on Stack" &lt;&lt; endl;
              return;
          }
          top++;
          A[top] = P;
      }
  };
  </code></pre>
  
  <p>On the line <code>A[top] = P;</code> towards the bottom of the code I am getting the error <code>No viable overloaded '='.</code> </p>
  
  <p>I don't understand why this is not working. I wrote the overload function for the assignment in the Person class, and I managed to overload <code>&lt;&lt;</code> properly earlier. I am new to C++ and overloading is a very new concept but I cannot figure out why this error is being thrown.</p>
  
  <p>How to fix it?</p>