If an elaborated-type-specifier is the sole constituent of a
declaration, the declaration is ill-formed unless it is an explicit
specialization ([temp.expl.spec]), an explicit
instantiation ([temp.explicit]) or it has one of the following
forms:
In the first case, the attribute-specifier-seq, if any, appertains
to the class being declared; the attributes in the
attribute-specifier-seq are thereafter considered attributes of
the class whenever it is named.
This rule also applies to
the form of elaborated-type-specifier that declares a
class-name or friend class since it can be construed
as referring to the definition of the class.