Obama says Trump, Cruz doing Democrats a ‘favor’