When is an object determined by the number of maps from the other objects?


Let $C$ be a category with finite hom-sets.
Suppose that $X$ and $Y$ are objects in $C$ such that $C(Z,X)cong C(Z,Y)$ for any Z (with no naturality condition).
For which categories $C$ does it follows that $X cong Y$?
(Of course, it is true for posets).

A somewhat related question is the following.

Let $C$ be a symmetric monoidal closed category.
Suppose that $X$ and $Y$ are objects in $C$ such that $(X,Z)cong (Y,Z)$ for any Z (with no naturality condition).
For which categories $C$ does it follows that $X cong Y$?