Measurements are presented of associated production of a boson and a charm quark ( ) in proton-proton collisions at a center-of-mass energy of 13 . The data correspond to an integrated luminosity of 35.7 collected by the CMS experiment at the CERN LHC. The bosons are identified by their decay into a muon and a neutrino. The charm quarks are tagged via the full reconstruction of mesons that decay via . A cross section is measured in the fiducial region defined by the muon transverse momentum , muon pseudorapidity , and charm quark transverse momentum . The inclusive cross section for this kinematic range is . The cross section is also measured differentially as a function of the pseudorapidity of the muon from the boson decay. These measurements are compared with theoretical predictions and are used to probe the strange quark content of the proton.