[class.pre]
11 Classes [class]
11.1 Preamble [class.pre]
A class is a type.
Its name becomes a class-name ([class.name]) within its scope.
An object of a class consists of a (possibly empty) sequence of members and base class objects.
class-key:
class
struct
union
A class-specifier whose class-head omits the class-head-name defines an unnamed class.
Otherwise, the class-name is an identifier; it is not looked up, and the class-specifier introduces it.
The component name of the class-name is also bound in the scope of the class (template) itself; this is known as the injected-class-name.
For purposes of access checking, the injected-class-name is treated as if it were a public member name.
A class-specifier is commonly referred to as a class definition.
A class is considered defined after the closing brace of its class-specifier has been seen even though its member functions are in general not yet defined.
If its class-name is an identifier, the class-specifier shall correspond to one or more declarations nominable in the class, class template, or namespace to which the nested-name-specifier refers; they shall all have the same target scope, and the target scope of the class-specifier is that scope.
[Example 1: namespace N { template<class> struct A { struct B; }; } using N::A; template<class T> struct A<T>::B {}; template<> struct A<void> {}; — end example]
[Note 2:
The class-key determines whether the class is a union ([class.union]) and whether access is public or private by default ([class.access]).
A union holds the value of at most one data member at a time.
— end note]
Each class-property-specifier shall appear at most once within a single class-property-specifier-seq.
Whenever a class-key is followed by a class-head-name, the identifier final, and a colon or left brace, the identifier is interpreted as a class-property-specifier.
[Example 2: struct A; struct A final {}; struct X { struct C { constexpr operator int() { return 5; } }; struct B final : C{}; }; — end example]
[Note 3:
Complete objects of class type have nonzero size.
Base class subobjects and members declared with the no_unique_address attribute ([dcl.attr.nouniqueaddr]) are not so constrained.
— end note]
[Note 4:
Other plausible operators, such as equality comparison, can be defined by the user; see [over.oper].
— end note]