This is written in learning operator overloading a piece of code, in the Person class wrote a copy constructor to override "=" operator, the return type without reference operator & amp; , so can't return true p2, in my understanding of the test () function in p2 should be equal to 18, because after the first p2. The operator (p1) after return is not really the p2, so the back of the function with the p2 it doesn't matter, the if statement commented out indeed runtime 18, but run out if it's not commented out deficiency is 30. If there had been a great god answer why run twice?