  On August 17, 2017, Advanced LIGO and Virgo observed GW170817, the first
gravitational-wave (GW) signal from a binary neutron star merger. It was
followed by a short-duration gamma-ray burst, GRB 170817A, and by a non-thermal
afterglow emission. In this work, a combined simultaneous fit of the
electromagnetic (EM, specifically, afterglow) and GW domains is implemented,
both using the posterior distribution of a GW standalone analysis as prior
distribution to separately process the EM data, and fitting the EM and GW
domains simultaneously. These approaches coincide mathematically, as long as
the actual posterior of the GW analysis, and not an approximation, is used as
prior for the EM analysis. We treat the viewing angle, $\theta_v$, as shared
parameter across the two domains. In the afterglow modelling with a Gaussian
structured jet this parameter and the jet core angle, $\theta_c$, are
correlated, leading to high uncertainties on their values. The joint EM+GW
analysis relaxes this degeneracy, reducing the uncertainty compared to an
EM-only fit. We also apply our methodology to hypothetical GW170817-like events
occurring in the next GW observing run at $\sim$140 and 70 Mpc. At 70 Mpc the
existing EM degeneracy is broken, thanks to the inclusion of the GW domain in
the analysis. At 140 Mpc, the EM-only fit cannot constrain $\theta_v$ nor
$\theta_c$ because of the lack of detections in the afterglow rising phase.
Folding the GW data into the analysis leads to tighter constraints on
$\theta_v$, still leaving $\theta_c$ unconstrained, requiring instruments with
higher sensitivities, such as Athena.
