Measurement of the ratio of $B_c^+$ branching fractions to $J/\psi\pi^+$ and $J/\psi\mu^+\nu_\mu$