An iCloud lock, referred to as an Activation Lock, on an iPhone is removed only by inserting the Apple ID and password associated with the iCloud account. Activation Lock automatically turns on when you set up the Find My iPhone feature with iOS 7 or later.
Find My iPhone is a program that keeps your phone safe by disallowing would-be thieves from erasing its content and selling your phone. With Activation Lock enabled, your phone cannot have its contents deleted, nor can it be restored, without your Apple ID and password. If you lose your phone, you can use Find My iPhone to find it through Apple's website; type a message to be displayed on its screen should anyone find it; delete the contents of your credit or debit information stored in programs on your iPhone; and play a locator sound should your iPhone be nearby and you are attempting to find it.
Activation Lock cannot be removed by connecting the phone to iTunes and attempting to restore the settings and content to factory settings. It also cannot be removed with a new Apple ID and password connected with another device, because the Apple ID entered through Find My iPhone is the only Apple ID that can be associated with the phone until it is removed.