title: friend function + operator overloading
body: <p>I am working on a project for class that is a sort of payroll. Part of the prompt says </p>
  
  <p>"You may define a friend function that overloads &lt;&lt; for displaying the Employee object information(i.e. the overloading &lt;&lt; function will call the virtual print function.)" </p>
  
  <p>I know what a friend function is, but I don't recall learning about the overloading &lt;&lt; part. I tried searching for some easy copy paste implementation... but my compiler flares up no matter what I try.</p>
  
  <p>How do I go about actually implementing this? Here's the code I have so far:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  //Base class
  class Employee
  {
  public:
      Employee(string a, string b, string c, string d);
      ~Employee();
      int virtual earnings();
      void virtual print();
  protected:
      string first, last, brithday, department;
  };
  
  Employee::Employee(string f, string l, string b, string d)
  {
      first = f;
      last = l;
      brithday = b;
      department = d; //department code
      cout &lt;&lt; "Employee created." &lt;&lt; endl;
  }
  
  Employee::~Employee(void)
  {
      cout &lt;&lt; "Employee deleted." &lt;&lt; endl;
  }
  
  int Employee::earnings()
  {
      int earnings = 100; //To be added
      return earnings;
  }
  
  void Employee::print()
  {
      //IDK 
  }
  </code></pre>