title: overloading assignment operator With subscript operator
body: <p>I overloaded both subscript operator and assignment operator  and I am trying to get right value to assignment operator
  example
   <code>Array x;
  x[0]=5;</code>
  by overloading subscript operator i can get value 0 but when i overload assignment operator it does the assignment but it doesn't use my overloaded function because vaiable 2 should have value 5.</p>
  
  <pre><code>class Array
  {
  
  public:
      int *ptr;
      int one,two;
      Array(int arr[])
      {
          ptr=arr;
      }
  
      int &amp;operator[](int index)
      {
          one=index;
          return ptr[index];
      }
      int &amp; operator=(int x){
          two=x;
          return x;
      }   
  };
  
  int main(void)
  {
      int y[]={1,2,3,4};
      Array x(y);
      x[1]=5;
      cout&lt;&lt;x[0]&lt;&lt;endl;
  }
  </code></pre>