<s>
A	O
friend	B-Application
class	I-Application
in	O
C++	B-Language
can	O
access	O
the	O
private	O
and	O
protected	O
members	O
of	O
the	O
class	O
in	O
which	O
it	O
is	O
declared	O
as	O
a	O
friend	O
.	O
</s>
<s>
A	O
significant	O
use	O
of	O
a	O
friend	B-Application
class	I-Application
is	O
for	O
a	O
part	O
of	O
a	O
data	O
structure	O
,	O
represented	O
by	O
a	O
class	O
,	O
to	O
provide	O
access	O
to	O
the	O
main	O
class	O
representing	O
that	O
data	O
structure	O
.	O
</s>
<s>
The	O
friend	B-Application
class	I-Application
mechanism	O
allows	O
to	O
extend	O
the	O
storage	O
and	O
access	O
to	O
the	O
parts	O
,	O
while	O
retaining	O
proper	O
encapsulation	O
as	O
seen	O
by	O
the	O
users	O
of	O
the	O
data	O
structure	O
.	O
</s>
<s>
Similar	O
to	O
a	O
friend	B-Application
class	I-Application
,	O
a	O
friend	B-Language
function	I-Language
is	O
a	O
function	O
that	O
is	O
given	O
access	O
to	O
the	O
private	O
and	O
protected	O
members	O
of	O
the	O
class	O
in	O
which	O
it	O
is	O
declared	O
as	O
a	O
friend	O
.	O
</s>
<s>
Friendships	O
are	O
not	O
inherited	B-Language
–	O
if	O
class	O
Base	O
is	O
a	O
friend	O
of	O
class	O
X	O
,	O
subclass	O
Derived	O
is	O
not	O
automatically	O
a	O
friend	O
of	O
class	O
X	O
;	O
and	O
if	O
class	O
X	O
is	O
a	O
friend	O
of	O
class	O
Base	O
,	O
class	O
X	O
is	O
not	O
automatically	O
a	O
friend	O
of	O
subclass	O
Derived	O
.	O
</s>
