I have been tasked to modify a complex number calculator. I face an issue where I am not sure of how to return an object from a friend function that will add up each component and then be passed to a display class member function to output the contents to the screen.
Make the return type of addrealandimag Complex rather than double? Also, since neither of the reference parameters are expected to be modified, either take them by value or make them const correct.