but the VS 2013 is saying 'input' in istream & ostream functions as 'Unidentifier'. Although i have made them FRIENDS of class 'complex_number'. . . Help!
I don't get what's the purpose of line 18 and 19. On the LHS of the assignment operator you use input, but what input exactly? I guess you mean some input belonging to a complex_number object but which one? The compiler doesn't know.
I don't think you need those lines at all. operator<< normally don't manipulate the second operand so normally you would make it a const reference. ostream& operator<<(ostream &user_stream_out , const complex_number &print_complex_number)
What i thought it should be:
Lines 18,19 uses a complex_number object named 'print_complex_number'
and my class has some other functions that do some particular task and result is stored in the class private member function input which is of type struct complex_number_packet.
I wanted to overload the stream insertion and stream extraction operator such that it work for my this class accurately. Therefore, i tried to COPY data of class private member function input and assigned them to class's another object named 'print_complex_number' member by member. Also i declared ostream & istream functions to be friends to class but input which is a private member function isn't declared in this scope. Why it is so? Friends can access private members too.
I think you might confuse friend functions with member functions. A friend function is not a member function of the class. Inside a friend function you can access the private members of the class but you still need an object to access them. That is why you can't access input without specifying the object.
Another way to say this is that your operators are in global scope, so input.real_part and input.complex_part on lines 18 and 19 would have to come from a global variable named input. However, you haven't shown us such a declaration… In fact, your declaration of input is inside class complex_number. Thus, I wonder if you meant to make the output operator a member of that class???
Why do you want to have real_part, complex_part as part of complex_number_packet and inturn use that struct within complex_number class instead of placing those two element declarations directly within class complex_number as private data members? Are you using struct complex_number_packet for someother purpose outside the scope/meaning of complex_number?