I overloaded both subscript operator and assignment operator and I am trying to get right value to assignment operator
example
Array x;
x[0]=5;
by overloading
You overloaded operator= for the Array class, not for int (which you can't do, by the way). x[1]=5; is using Array::operator[] for element access, which returns an int&, and then uses the normal int assignment operator for the =5 part. Array::operator= is only used when you're assigning to the whole object (i.e. the way you've defined it, you can do x = 5;), not to its elements/members.