<s>
Barton	B-Language
–	I-Language
Nackman	I-Language
trick	I-Language
is	O
a	O
term	O
coined	O
by	O
the	O
C++	O
standardization	O
committee	O
(	O
ISO/IEC	O
JTC1/SC22	O
WG21	O
)	O
to	O
refer	O
to	O
an	O
idiom	O
introduced	O
by	O
John	O
Barton	O
and	O
Lee	O
Nackman	O
as	O
restricted	O
template	O
expansion	O
.	O
</s>
<s>
The	O
idiom	O
is	O
characterized	O
by	O
an	O
in-class	O
friend	B-Language
function	I-Language
definition	O
appearing	O
in	O
the	O
base	O
class	O
template	O
component	O
of	O
the	O
curiously	B-Language
recurring	I-Language
template	I-Language
pattern	I-Language
(	O
CRTP	O
)	O
.	O
</s>
<s>
The	O
Barton	B-Language
–	I-Language
Nackman	I-Language
trick	I-Language
,	O
then	O
,	O
achieves	O
the	O
goal	O
of	O
providing	O
a	O
generic	O
user-defined	O
equality	O
operator	O
without	O
having	O
to	O
deal	O
with	O
such	O
ambiguities	O
.	O
</s>
<s>
The	O
term	O
is	O
sometimes	O
mistakenly	O
used	O
to	O
refer	O
to	O
the	O
curiously	B-Language
recurring	I-Language
template	I-Language
pattern	I-Language
(	O
CRTP	O
)	O
.	O
</s>
<s>
As	O
explained	O
above	O
,	O
the	O
Barton	B-Language
–	I-Language
Nackman	I-Language
trick	I-Language
is	O
,	O
instead	O
,	O
a	O
distinct	O
idiom	O
(	O
that	O
relies	O
on	O
the	O
CRTP	O
)	O
.	O
</s>
<s>
where	O
v1	O
and	O
v2	O
are	O
of	O
type	O
value_type	O
,	O
it	O
attempts	O
argument-dependent	B-Language
lookup	I-Language
(	O
ADL	O
)	O
for	O
operator	O
==	O
.	O
</s>
<s>
This	O
lookup	O
includes	O
consideration	O
of	O
friend	B-Language
functions	I-Language
declared	O
in	O
value_type	O
and	O
its	O
base	O
classes	O
.	O
</s>
<s>
The	O
Barton	B-Language
–	I-Language
Nackman	I-Language
trick	I-Language
originally	O
relied	O
not	O
on	O
ADL	O
but	O
on	O
a	O
C++	O
feature	O
called	O
"	O
friend	O
name	O
injection	O
"	O
,	O
in	O
which	O
an	O
in-class	O
declaration	O
of	O
a	O
friend	B-Language
function	I-Language
made	O
the	O
function	O
name	O
visible	O
in	O
the	O
immediately	O
surrounding	O
namespace	O
scope	O
(	O
possibly	O
the	O
global	O
scope	O
)	O
.	O
</s>
<s>
Eventually	O
,	O
the	O
rules	O
for	O
argument-dependent	B-Language
lookup	I-Language
were	O
adjusted	O
to	O
replace	O
friend	O
name	O
injection	O
by	O
a	O
less	O
drastic	O
mechanism	O
,	O
described	O
above	O
,	O
that	O
maintained	O
the	O
validity	O
of	O
Barton	O
and	O
Nackman	O
's	O
technique	O
.	O
</s>
<s>
Note	O
,	O
too	O
,	O
that	O
the	O
friend	O
specifier	O
is	O
essential	O
,	O
even	O
if	O
the	O
defined	O
friend	B-Language
functions	I-Language
do	O
not	O
actually	O
need	O
to	O
access	O
nonpublic	O
members	O
of	O
the	O
befriending	O
class	O
.	O
</s>
