From 7004713981309056073
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,ac06fef48c3c04df
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,ac06fef48c3c04df
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1995-01-26 09:19:28 PST
Path: nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!Germany.EU.net!Munich.Germany.EU.net!ibm.de!aixssc.uk.ibm.com!watnews.watson.ibm.com!locutus.rchland.ibm.com!mahjongg.rchland.ibm.com!brettp
From: brettp@mahjongg.rchland.ibm.com (Brett Peterson)
Newsgroups: comp.lang.c++,comp.std.c++
Subject: Re: friends and local classes
Date: 26 Jan 1995 17:19:28 GMT
Organization: IBM Rochester MN
Lines: 34
Distribution: world
Message-ID: <3g8lj0$q36@locutus.rchland.ibm.com>
References: <3g2ups$bhu@ra.ibr.cs.tu-bs.de> <3g5pn6$16p@news.cc.utah.edu>
NNTP-Posting-Host: mahjongg.rchland.ibm.com
Xref: nntp.gmd.de comp.lang.c++:88275 comp.std.c++:11268

In article <3g5pn6$16p@news.cc.utah.edu>, swillden@fcom.cc.utah.edu (Shawn Willden) writes:
|> Andreas Rossberg (ti953017@rzcipa01.rz.tu-bs.de) wrote:
|> 
|> : 	class A
|> : 	{
|> : 	private:
|> : 		class B;
|> : 		friend class B;
|> : 		class B { /* ... */ };
|> : 	};
|> 
|> : This is tedious and even used to be illegal.
|> 
|> : Why are the rules that way? Could anybody give me a hint? However, IMO, the
|> : language should at least allow the terse notion of
|> 
|> : 		friend class B { /* ... */ };
|> 
[snip]
|> or
|> 		friend class B;
|> 		class B { /* ... */ };
|> 
|> are legal, and closer.
|> 

This is not semantically equivalent to what Andreas wrote above. Since "friend class B" introduces
B, then the name B is entered into the same scope as the name of the containing class. Thus,
"friend class B" gives friendship to the global class B and not to the local class B.

