title: Use of overloaded operator '<<' is ambiguous (with operand types 'ostream' (aka 'basic_ostream<char>') and 'Person')
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  class Person{
  public:
      string name;
      int age, height, weight;
  public:
      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;
      }
      friend ostream&amp; operator&lt;&lt;(ostream&amp; os, const Person&amp; p);
  };
  
  ostream&amp; operator&lt;&lt;(ostream os, const Person&amp; p)
  {
      os &lt;&lt; p.name &lt;&lt; "\n" &lt;&lt; p.age &lt;&lt; "\n" &lt;&lt; p.height &lt;&lt; "\n" &lt;&lt; p.weight &lt;&lt; "\n\n";
      return os;
  }
  
  class Node {
  public:
      Person* data;
      Node* next;
      Node(Person*A) {
          data = A;
          next = nullptr;
      }
  };
  
  class LinkedList {
  public:
      Node * head;
      LinkedList() {
          head = nullptr;
      }
  
      void InsertAtHead(Person*A) {
          Node* node = new Node(A);
          node-&gt;next = head;
          head = node;
      }
  
      void Print() {
          Node* temp = head;
          while (temp != nullptr) {
              cout &lt;&lt; *(temp-&gt;data) &lt;&lt; " ";
              temp = temp-&gt;next;
          }
          cout &lt;&lt; endl;
      }
  };
  
  int main() {
      LinkedList* list = new LinkedList();
  
      list-&gt;InsertAtHead(new Person("Bob", 22, 145, 70));                 list-&gt;Print();
  }
  </code></pre>
  
  <p>Hello, I am new to C++ and this is the first time I am overloading an operator. I have done extensive research on how to do so and I do not think my flaw is with the ostream overload. I am aware that there are similar questions, but I cannot seem to get mine to work with the overload I made. Basically my goal is to be able to call the Print function in order to print out the linked list. I believe the issue is on the line "cout &lt;&lt; *(temp->data) &lt;&lt; " ";" but I am not sure and even if it is I do not know how to go about fixing it. Could someone explain to me what I am doing wrong? The title of the question is an error I am receiving on the line that I posted above which is why I am lead to believe something must be changed there. Thanks in advance!</p>