This declares a function foo that accepts an argument of the type bar*. If bar was not declared previously, this elaborate type specifier constitutes a declaration of bar in the namespace containing foo. I.e. as if you had written:

class bar; void foo(bar*);

Back to your example, X is a class template that expects a single type parameter, denoted by class T, but could have been denoted just the same as typename T. Said type parameter has a default argument, named by the elaborated class specifier class Z. That declaration can be rewritten just like the function above: