Switzerland and the United States reached an agreement in principle on Friday to settle out of court a case that sought to force the Swiss banking giant UBS to turn over the names of wealthy American clients suspected of tax evasion, a lawyer for the government said.