I have recently being working a lot with axiomatic set theory, and one of the first things I picked up on is that all members of a set are themselves sets. For example, $2 \in \mathbb{N}$ and $2 = \{\emptyset, \{\emptyset\}\}$.
However, how is this supposed to apply to P and NP in computational complexity? Both are described as sets, yet it seems that the problems they contain are not sets. I've sometimes also heard P and NP referred to "complexity classes" rather than sets, but I'm not sure if that's the same thing as a class in the NBG sense. (and even if it were, it wouldn't solve the issue because members of NBG classes are also sets.)
Is there some hand-waving (on the part of either set theorists or computer scientists) at work here? Or am I just failing to understand a key detail?
If we restrict to a fixed (finite) alphabet at the outset - say, we look at all languages over (= sets of strings formed from) the alphabet $\{0,1\}$ - then complexity classes are sets without further complications. In particular, if we use the alphabet $\{0,1\}$, then each complexity class is a subset of the set $\{0,1\}^{<\omega}$ of finite binary strings (and in particular an element of a complexity class is simply a subset of $\{0,1\}^{<\omega}$). Any finite alphabet - well, with more than one element :P - is sufficient for our purposes, so $\{0,1\}$ is a standard choice here.
However, sometimes complexity classes are defined so as to make sense over any finite alphabet whatsoever. In this case, complexity classes really are proper classes, but only for the rather silly reason that the class of finite alphabets is already a proper class. So technically if the text you're reading adopts a super-unnecessary level of generality at the outset, this may feel like an issue.
But even in that case, classes aren't appearing in a substantive way: if we fix a countably infinite alphabet $\Sigma$, then every finite language is equivalent in every imaginably relevant sense to (more precisely, is in bijection with) a finite subalphabet of $\Sigma$, and so we can "collapse back down" to the set-context.