A name that appears in a declaration D
of a template T
is looked up
from where it appears
in an unspecified declaration of T
that is or is reachable from D
from which no other declaration of T
that contains the usage of the name is reachable.
If the name is dependent (as specified in [temp.dep]
it is looked up for each specialization (after substitution)
because the lookup depends on a template parameter.