title: C++: Operator overloading of < for pointers to objects
body: <p>I would like to compare two objects through their addresses. I tried operator overloading and it does not seem to work for pointers, but works for objects themselves. The following is the relevant code:</p>
  
  <pre><code>class C {
          public:
                  int x;
  };
  .
  .
  .
  bool operator &lt;( C *ptr_c1, C *ptr_c2 )
  {
          return ( (*ptr_c1).x &lt; (*ptr_c2).x );
  }
  </code></pre>