A Pokemon can always have perfect IVs.
Wild Pokemon as well. Any number of perfect IVs, but it is based on luck.
However, I have found something about chains affecting IVs, but I am not sure if it's true since it isn't official(it is tested though).
The higher the chain, the higher the number of perfect IVs. Sadly you can only get 3 guaranteed perfect IVs like this.
![image](/pokebase/qa-plugin/https-img-proxy/image.php?key=95805cb30f3a2ce5&url=http%3A%2F%2Fi.gyazo.com%2Fe39a3c53c2117ac3bbdc248deb14884c.png)
As you can see, up to a chain of 20 you will not have any perfect IVs guaranteed. From 21 to 40 you will have one, 41-60 you will have two and from 61 onward you will have 3 guaranteed perfect IVs.
Since you had your chain around 45, you were guaranteed 2, and got the third one by luck.
Source
Hope I helped.