friend int pqr(abc); in order. This does not work because the type abc not defined before you used it as the type of the parameter in the pqr() function. Define it before the function:
#include<iostream> // By the way, "using namespace std" can cause ambiguities. // See http://www.parashift.com/c++-faq-lite/coding-standards.html
I know that you want to use a local class, but what you configured will not work. Local classes are visible only inside the function in which it is defined. If you want to use the abc instance outside the pqr() function, you must define the abc class outside the function.
However, if you know that the abc class will be used only inside the pqr() function, then you can use the local class. But in this case, you need to fix the friend declaration a bit.
#include<iostream> // By the way, "using namespace std" can cause ambiguities. // See http://www.parashift.com/c++-faq-lite/coding-standards.html
This compiles without warning on Visual C ++ (compiler version 15.00.30729.01).
source share