title: How overload operator < for sort method for objects?
body: <p>I have this object, for example</p>
  
  <pre><code> class Employee{
      int id;
      string name;
      string secName;
      }
  </code></pre>
  
  <p>My main is :</p>
  
  <pre><code>int main(){
  vector&lt;Employee&gt; vec = {Employee(1, "Andy", "Good"), Employee(5, "Adam", "Bad"), Employee(2, "Some", "Employee")}
  
  sort(vec.begin(), vec.end())
  
  }
  </code></pre>
  
  <p>I know how overload sort method for vector when I have one parameter for sorting. It's like:</p>
  
  <pre><code> bool operator&lt;(Employee a, Employee b ){
      if (a.name&lt;b.name) return true;
      else return false;
      }
  </code></pre>
  
  <p>But the point is that I have sort not only on one parameter, but on all. So how should I change overloading method?</p>
  
  <p>I've tried this way, but it doesn't work.</p>
  
  <pre><code>bool operator&lt;(Employee a, Employee b)
  {
      if (a.id &lt; b.id)
          if (a.name &lt; b.name)
              if (a.surname&lt;b.surname)return true; else return false;
          else return false;
      else return false;
  }
  </code></pre>