Also I have a question... :)
What is "friend" attribute? And usage?
Does noone know about this?
Try reversing function args lines 10 and 36. You seek int+rect not rect+int (which you could do with a member function).
@JM: The function (operator+) must be a friend of the rect class so it can refer to the private member s on line 38.
If I want to write it with friend How Should I write?
In this program ,I think friend function is true.
I had not read your talking well .It is working now.
You're welcome. Glad you got it. Sorry if my answer was unclear.