Almost periodic solutions for a class of Duffing-like systems