I receive about 20 spam calls per day. In contrast, I receive about 0.2 legitimate calls per day. Google itself suspects that these are spam calls, because it pops up a bright red "SUSPECTED SPAM CALLER" warning when the phone begins ringing. And yet, I have found no option to have the phone automatically decline the call. There's not even an option to silence the ringer for any call not from my contacts; I actually…
iOS 10 added "call blocking" as an app-type, which lets you choose apps which can filter phone calls for you. They can flag calls as possible-spam, or completely block them. (See [1] for Hiya's options screen, as an example.)
An "only ring for my friends" feature is sort of possible. You can keep your phone in "do not disturb" mode, and add people who you want to be able to call you to your "VIPs" list to let them through. That's a fair bit of manual management, though, which is a pain.
I don't think it's possible to make a call-blocker app which functions as a whitelist, sadly, because I think this is like their browser content blockers and operates as the app providing a list of blocked numbers for privacy reasons.