Friend Functions in c++

This video tutorial explains the friend functions in c++.
You are gonna learn what is a friend function, how to declare a friend function, how to define a friend function, how to access the properties or members of a class in a friend function in detail with example.

source code for this tutorial

#include <iostream>

using namespace std;

class Human{
string name;
int age;

    Human(string iname,int iage){
    name = iname;
    age = iage;
    void tellme(){
    cout <<name<<endl<<age<<endl;
 friend void display(Human man);


void display(Human man){
cout <<<<endl<<man.age<<endl;


int main()
    Human anil("anil",24);
    return 0;

Back To Top