The compiler sees that you are calling operator+(test) and is trying to implicitly convert 2 to test using the test(int i,int j=0) constructor test(int i,int j=0) .
If you want to make the conversion explicit, you must change the constructor to explicit test(int i, int j=0) . In this case, your code will generate a compiler error, because 2 cannot be implicitly converted to test . You will need to change the expression to t1 + test(2) .
source share