Capital One said it will buy Discover Financial Services for $35 billion, a deal that would bring two of the nation’s biggest credit card companies together.