the program is displaying garbage value as sum, this is because the destructor is called when the operator+ function is called. Please help me correct this.
The destructor is being called for the copy passed as a parameter to you + operator and again for the copy returned after the invocation of the default assignment.
You should implement a copy constructor and override the assignment operator. This is the purpose of the exercise.