You can check estimates of past immigration wait times online. Look for past weeks at the same day/time to get an idea of how busy it's likely to be. This only covers the wait for the primary immigration check; baggage claim and the exit through customs (normally quick, unless they want to see your bags or you have something to declare) are additional to the listed times. But as Henning Makholm points out, it's difficult to predict. Front of the line vs back of the line, exactly how busy it is at that moment, citizen vs non-citizen, whether they're stopped for extra questioning, how long bags take, etc...
As a broad rule of thumb, unadjusted for any of the above factors, if you arrive 30 minutes after the flight arrives, your friend likely will not be waiting, and you potentially will be. The later you arrive after that, the higher the likelihood your friend will be waiting around.
At SFO, you could wait at the cell phone lot or perhaps someplace like the Millbrae In-N-Out or Starbucks. Your friend can send you a text when they're getting close to exiting, so you're not paying for parking or endlessly circling the terminal. You could also use Waze or Google Maps for real-time drive times to the airport, so as to plan your arrival taking traffic into account.
If your friend is a US or Canadian citizen, make sure to tell them they can use mobile passport control.