title: Unary - operator overloading using friend function
body: <p>I have written this code in an attempt to perform overloading on the unary operator - using a friend function. Somehow, there is no effect on the inital values I've passed.</p>
  
  <pre><code>#include&lt;iostream&gt;
  //fifty6s
  using namespace std;
  class invert_position
  {
      int x,y;
      public:
          invert_position(int a,int b)
          {
          x=a;
          y=b;
          }
      void show()
          {
              cout&lt;&lt;"\nx="&lt;&lt;x;
              cout&lt;&lt;"\ny="&lt;&lt;y;
          }
      friend void operator -(invert_position);
  };
  void operator -(invert_position i)
  {
      i.x=-i.x;
      i.y=-i.y;
  }
  int main()
  {
      invert_position i(2,3);
      -i;
      i.show();
      return 0;
  }
  </code></pre>