Специализация шаблона класса в области видимости?

Почему специализация S в A легальна, а S в B нет?

(если B не закомментирован) GCC 4.8.1: ошибка: явная специализация в области без пространства имен nameкласс B ’

#include 
#include 

class Y {};
class X {};

struct A {
  template
  class S;

  template
  struct S < T, typename std::enable_if< std::is_same< Y, T >::value >::type > 
  {
    int i = 0;
  };

  template
  struct S < T, typename std::enable_if< std::is_same< X, T >::value >::type > 
  {
    int i = 1;
  };
};

/*
class B
{
    template
    class S;

    template
    class S < Y > {};

    template
    class S < X > {};
};
*/


int main()
{
    A::S< X > asd;
    std::cout < asd.i < std::endl;
}

Ответы на вопрос(1)

Ваш ответ на вопрос