title: How do I insert user-defined objects into STL set?
body: <p>I am trying to insert a object Point2D into a Point2D set but i am not able to do it, it seems the set works for int and char but not for objects. </p>
  
  <p>I need help to know how to insert objects into the set ??? Assuming i want to sort them by ascending order of x value</p>
  
  <pre><code>class Point2D
  {
  public:
      Point2D(int,int);
      int getX();
      int getY();
  
      void setX(int);
      void setY(int);
  
      double getScalarValue();
  
  protected:
      int x;
      int y;
      double distFrOrigin;
      void setDistFrOrigin();
  };
  
  
  int main()
  {
      Point2D abc(2,3);
  
      set&lt;Point2D&gt; P2D;
      P2D.insert(abc); // i am getting error here, i don't know why
  }
  </code></pre>