myfriend(student)
student
123456789101112131415161718192021
#include<iostream> using namespace std; class student { int i; friend void myfriend(student&); public: student(int val) {i = val;} ~student() {cout<<"exiting"<<endl;} }; void myfriend(student &A) { cout<<"value="<<A.i<<endl; } int main() { student B(10); myfriend(B); }