Forgot iPhone passcode? (Not lock screen passcode but security passcode)?

I know the lock screen passcode to get to the home screen etc. However I let my friend put a security passcode which is the passcode used to hide or show certain apps and also to reset factory settings etc. On an iPhone.

BUT HE FORGOT IT!

So how do I reset this passcode or bypass it?

I let him do the passcode because he was supposed to be my safekeeper of the passcode as I removed Safari on my own to put in a browser that had web filters on it so that I couldn't access Safari.

You must either reset the phone, or restore it from the last backup you have that didn't have the code set.