Okay, it's seems like I'm missing something here:

Qt Code:
  1. #include <QString>
  2. #include <iostream>
  3.  
  4. class TestItem
  5. {
  6. public:
  7. TestItem(const QString &value)
  8. {
  9. m_value = value;
  10. }
  11.  
  12. QString value() const
  13. {
  14. return m_value;
  15. }
  16.  
  17. bool operator==(const TestItem &other) const
  18. {
  19. return this->value() == other.value();
  20. }
  21.  
  22. private:
  23. QString m_value;
  24. };
  25.  
  26. int main(int argc, char *argv[])
  27. {
  28. TestItem *one = new TestItem("abc");
  29. TestItem *two = new TestItem("abc");
  30.  
  31. if(one == two)
  32. std::cout << "Match";
  33. else
  34. std::cout << "No Match";
  35.  
  36. return 0;
  37. }
To copy to clipboard, switch view to plain text mode 
This returns ALWAYS "No Match". But if I create the objects on the stack and not on the heap it works:
Qt Code:
  1. TestItem one("abc");
  2. TestItem two("abc");
To copy to clipboard, switch view to plain text mode 
What do I have to do to make it work with heap initialized objects ? Thank you.