Here's why:
* "Pet" modifies the noun "ferret", describing the specific type of ferret Carlos has.
* "Cage" is the object of the verb "wanted".
* "New" is an adjective describing the type of cage Carlos wants.
Therefore, "pet" functions as an adjective because it modifies another noun ("ferret") to provide more information about it.