If private members have to be accessed directly from outside the class but the access specifier must not be changed, what should be done?
If private members have to be accessed directly from outside the class but the access specifier must not be changed, what should be done? Correct Answer Friend function should be used
For calling the function directly, we can’t use another function because that will be indirect call. Using friend function, we can access the private members directly.