Additional information for finding the first solution:
The solution requires a two-phase search or an argument-dependent search. Unfortunately, MSVC does not yet fully support this.
Compiling this in VS Community 2019 16.1.6 with add-in 1.70 leads to an unclear error:
Error C2063 'boost::serialization::serialize': not a function
Despite the fact that compliance mode is activated using the / permissive- flag and the latest language standard / std :: C ++ is selected, as described in this MSVC blog post .
Adding a typename qualifier to a friend declaration solves the problem:
template <typename Ar, typename U> friend void boost::serialization::serialize(typename Ar&, A<U>&, const unsigned);
Even more interesting is the disappointment:
if class A is not a template class, then it does not work in any case, the same error as above ... Code example: http://coliru.stacked-crooked.com/a/ecfbb39d5975d753
source share