title: How to assign value to left side using Overload operator[]?
body: <p>I have made the following code:-</p>
  
  <pre><code>class A{
       bool bFlag[2];
  public:
    A(){
        for(int  i = 0; i &lt; 2; i++)
            bFlag[i] = false;
    }
  
    bool operator[](int r){ //i know how to assign value to R.H.S using operator[]
        if( r &gt;= 0 || r &lt; 2 ){
            bFlag[r] = true;
            return bFlag[r];
     }
     return false;        
    }   
  };
  
  int main(){
      A obj;
      bool x;
      x = obj[0]; //this i know
      //obj[1] = x; //how to do this is my doubt?
      return 0;
  }
  </code></pre>
  
  <p>I dont know to set value to <code>L.H.S</code> using <code>operator[]</code>. 
  Please guide me to how to set <code>x</code> value to <code>obj[1]</code></p>