Washington lawyers and ­lobbyists at K&L Gates, Squire Patton Boggs and other firms with ties to Rep. Kevin McCarthy, R-Calif., are optimistic they will have his ear as he settles into his new role as House majority leader.

Virginia Republican Rep. Eric Cantor’s unexpected primary defeat this month to economics professor David Brat was unsettling to clients, lobbyists and lawyers said. But McCarthy, who has served under Cantor as the House’s No. 3 Republican since 2011, has the skill to move legislation through a divided Congress, they said.