The class of all functions between classes (NBG)

Is it possible in NBG (von Neumann-Bernays-Gödel set theory) to construct the class of all functions $X \to Y$ between two (proper) classes $X,Y$? I guess that this does not work. In the special case $Y=\{0,1\}$ we would get the class of all subclasses of $X$, which does not exist. Can someone confirm this?

As far as I remember GBN, you cannot, because any function whose domain is a proper class is not a set.

Indeed, let $f:X\rightarrow Y$ a function (hence a subclass of $X\times Y$ satisfying certain requirements). Consider the map $\pi^X:X\times Y\rightarrow X$ that sends $(x,y)\mapsto x$. This is a function between classes.

Now, suppose $f$ is a set.

$\pi^X|f:f\rightarrow X$ is a surjective function. But the image of a set through a function is a set (see here "Limitation of size").

However, the above does not answer the question of whether the (meta)category $\mathbf{Cls}$ of classes in NBG forms a cartesian closed category – all it shows is that the obvious candidate does not work. Instead, we make the following observations:
• $\mathbf{Cls}$ has finite limits: finite products are not a problem, and the formation of equalisers does not require quantification over classes.
• $\mathbf{Cls}$ has a subobject classifier: you can check that $\{ 0, 1 \}$ does the job.
• There is an object $V$ in $\mathbf{Cls}$ such that every object $X$ in $\mathbf{Cls}$ admits a monomorphism $X \to V$.
Thus we may apply an argument of McLarty to deduce that $\mathbf{Cls}$ is not topos, hence not cartesian closed.