That is known as an elaborated type specifier and is generally only necessary when your class name is "shadowed" or "hidden" and you need to be explicit.
class T
{
};
// for the love of god don't do this
T T;
T T2;
If your compiler is smart, it will give you these warnings:
main.cpp:15:5: error: must use 'class' tag to refer to type 'T' in this scope
T T2;
^
class
main.cpp:14:7: note: class 'T' is hidden by a non-type declaration of 'T' here
T T;
^
If your class is not previously defined, it will also act as a forward declaration.
For example:
template <typename T>
void Method()
{
using type = typename T::value_type;
}
Method<class T>(); // T is a forward declaration, but we have not defined it yet,
// error.
Otherwise it's not necessary.
class T
{
public:
using value_type = int;
};
// method implementation...
Method<T>();
Method<class T>(); // class is redundant here