A search for a light charged Higgs boson (H+) decaying to a W boson and a CP-odd Higgs boson (A) in final states with eμμ or μμμ is performed using data from pp collisions at s=13 TeV, recorded by the CMS detector at the LHC and corresponding to an integrated luminosity of 35.9 fb-1. In this search, it is assumed that the H+ boson is produced in decays of top quarks, and the A boson decays to two oppositely charged muons. The presence of signals for H+ boson masses between 100 and 160 GeV and A boson masses between 15 and 75 GeV is investigated. No evidence for the production of the H+ boson is found. Upper limits at 95% confidence level are obtained on the combined branching fraction for the decay chain, t→bH+→bW+A→bW+μ+μ-, of 1.9×10-6 to 8.6×10-6, depending on the masses of the H+ and A bosons. These are the first limits for these decay modes of the H+ and A bosons.