Overloading operator== <p>Guys I have some silly struct let's call it X and I also have a fnc (not a member of it) returning a pointer to this struct so it looks like so: </p> <pre><code> struct X { bool operator==(const X* right) { //... } }; X* get(X* another) { //... } </code></pre> <p>I also have line in code which 'tries' to compare pointers to those structs but the real intention is to compare those structs pointed to:</p> <pre><code>if (get(a) == get(b))//here obviously I have two pointers returned to be compared { //... } </code></pre> <p>I also defined member of <code>X operator==(const X* right)</code> which suppose to work in situations aforementioned but for reason I do not understand it doesn't. How to make it work (I CANNOT change the line <code>if (get(a) == get(b))</code> and also <code>get</code> MUST return pointer).</p>