Update wrapping code for Stan 2.4

No substantive changes; mirroring RStan's stan_fit.hpp