title: std::variant failing with templated class
body: <p>I am messing around with std::variant however I Just cant seem to get it to work. it works fine when I use the primitive types of c++, but if I use a templated class I get the following compiler errors. there are a lot of errors that I cant understand. this is the build output. I don't know how much of this is useful.</p>
  <pre class="lang-text prettyprint-override"><code>1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1521,32): error C2672: 'invoke': no matching overloaded function found
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1531): message : see reference to class template instantiation 'std::_Variant_single_visit_result&lt;_Callable,std::integer_sequence&lt;_Ty,5&gt;,std::variant&lt;int,char,bool,std::string,A&lt;int&gt;&gt; &amp;&gt;' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            _Callable=EventVisitor,
  1&gt;            _Ty=size_t
  1&gt;        ]
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1654): message : see reference to class template instantiation 'std::_Variant_all_visit_results_same&lt;_Callable,_ListOfIndexVectors,std::variant&lt;int,char,bool,std::string,A&lt;int&gt;&gt; &amp;&gt;' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            _Callable=EventVisitor
  1&gt;        ]
  1&gt;C:\Users\jaden\source\repos\Project8\Project8\Main.cpp(55): message : see reference to function template instantiation 'void std::visit&lt;EventVisitor,std::variant&lt;int,char,bool,std::string,A&lt;int&gt;&gt;&amp;,void&gt;(_Callable &amp;&amp;,std::variant&lt;int,char,bool,std::string,A&lt;int&gt;&gt; &amp;)' being compiled
  1&gt;        with
  1&gt;        [
  1&gt;            _Callable=EventVisitor
  1&gt;        ]
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1522,1): error C2893: Failed to specialize function template 'unknown-type std::invoke(_Callable &amp;&amp;,_Ty1 &amp;&amp;,_Types2 &amp;&amp;...) noexcept(&lt;expr&gt;)'
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\type_traits(1588): message : see declaration of 'std::invoke'
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1522,1): message : With the following template arguments:
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1522,1): message : '_Callable=_Callable'
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1522,1): message : '_Ty1=_First &amp;'
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1522,1): message : '_Types2={}'
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1522,1): error C2780: 'unknown-type std::invoke(_Callable &amp;&amp;) noexcept(&lt;expr&gt;)': expects 1 arguments - 2 provided
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\type_traits(1582): message : see declaration of 'std::invoke'
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(1531,36): error C2955: 'std::_All_same': use of class template requires template argument list
  1&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\variant(40): message : see declaration of 'std::_All_same'
  1&gt;Done building project &quot;Project8.vcxproj&quot; -- FAILED.
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  
  </code></pre>
  <p>here is the code.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;variant&gt;
  
  template&lt;class T&gt;
  class A
  {
  public:
      T t;
  };
  
  struct EventVisitor
  {
      void operator()(std::string s)
      {
          std::cout &lt;&lt; s &lt;&lt; std::endl;
      }
      void operator()(int i)
      {
          std::cout &lt;&lt; i &lt;&lt; std::endl;
      }
      void operator()(char c)
      {
          std::cout &lt;&lt; c &lt;&lt; std::endl;
      }
      void operator()(bool b)
      {
          if (b)
          {
              std::cout &lt;&lt; &quot;True&quot; &lt;&lt; std::endl;
          }
          else
          {
              std::cout &lt;&lt; &quot;False&quot; &lt;&lt; std::endl;
          }
      }
  };
  
  int main()
  {
      // std::variant&lt;int, char, bool, std::string&gt; myVariant; works but if I add A&lt;int&gt; it breaks
      std::variant&lt;int, char, bool, std::string, A&lt;int&gt;&gt; myVariant;
  
      myVariant = true;
      std::visit(EventVisitor{}, myVariant);
  }
  </code></pre>