> Both companies are private, so neither has a "market cap"
Private companies have shares. Given a per-share price, you can get a market cap. For a company with debt, like GrubHub, enterprise value is a better metric.
Same way you do for a public company. From trades and valuations. Private shares exchange hands in private transactions as well as almost every time the company raises money. If a company issues incentive stock options, they're required to calculate a 409A price, which while a bullshit number, is indeed a per-share price.
> how do you know what trades took place, and how many shares were traded, and at what price?
Company generally has these records. Various other sources, e.g. PitchBook, compile them. In some jurisdictions (e.g. UK and India) they have to be publicly announced, though that's becoming less common.
TL; DR It is incredibly wrong to suggest private companies don't have a market cap. As in finance 101 wrong.
In this case, GrubHub had taken on a bunch of debt; Wonder agreed to assume it, and GrubHub's owners/investors get $150M in cash.