title: overloading >= operator to compare pointers
body: <p>I am trying to overload <code>&gt;=</code> operator to Point class, so that I could compare two pointers to Point instances. But it does not look it calls the overloaded operator at all, because it is not printing the debug output.
  Why the overloaded operator is not called? How to make it work?</p>
  
  <p>The code I am trying is in file <code>operator.cc</code>:</p>
  
  <pre><code>#include &lt;ios&gt;
  #include &lt;iostream&gt;
  
  class Point {
      int x, y;
  public:
      Point(int x, int y);
      int getX();
      int getY();
      bool operator&gt;=(Point* p);
  };
  
  Point::Point(int x, int y) {
      this-&gt;x = x; this-&gt;y = y;
  }
  
  int Point::getX() {
      return this-&gt;x;
  }
  int Point::getY() {
      return this-&gt;y;
  }
  
  bool Point::operator&gt;=(Point* p) {
      std::cout &lt;&lt; "overloaded&gt;=" &lt;&lt; std::endl; // does not print anything
      return this-&gt;x &gt;= p-&gt;getX() &amp;&amp; this-&gt;y &gt;= p-&gt;getY();
  }
  
  int main() {
      Point* p1 = new Point(5, 5);
      Point* p2 = new Point(4, 4);
      bool result = p1 &gt;= p2;
      std::cout &lt;&lt; std::boolalpha &lt;&lt; result &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>But when I compile and run this code with <code>g++ operator.cc -o op &amp;&amp; ./op</code>, then I always get output <code>false</code>, and it doesn't print the <code>overloaded&gt;=</code> debug message.</p>