Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
DSA
22.8K+ articles
Python
21.3K+ articles
C++
4.3K+ articles
C++ Programs
2.4K+ articles
C Language
1.8K+ articles
How To
1.8K+ articles
cpp-class
57+ articles
Friend function and class
2+ articles
C++-friend keyword
1+ articles
cpp-friend
4 posts
Recent Articles
Popular Articles
Mutual friendship of Classes in C++ with Examples
Last Updated: 16 April 2021
Prerequisite: Friend Class in C++A friend class can access private and protected members of other classes in which it is declared as a friend. It is sometimes useful to al...
read more
C++
Friend function and class
C++-friend keyword
C++ Programs
cpp-friend
How To
C++ Program to swap two members using Friend Function
Last Updated: 07 July 2022
Pre-requisite: Friend FunctionCASE 1:Given two numbers a b, swap these two numbers using the friend function of C++.Examples:Input : a = 5, b = 9Output : a = 9, b = 5Inpu...
read more
Technical Scripter
C++
C++ Programs
cpp-friend
Friend Class and Function in C++
Last Updated: 30 May 2025
In C++, friend functions and friend classes are concepts that allow certain functions or classes to access the private and protected members of another class. These are us...
read more
C++
cpp-friend
Can We Access Private Data Members of a Class without using a Member or a Friend Function in C++?
Last Updated: 21 June 2022
The idea of Encapsulation is to bundle data and methods (that work on the data) together and restrict access of private data members outside the class. In C++, a friend fu...
read more
cpp-class
C Language
C++
cpp-friend
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !