Let's say I have classes A, B, and C which all derive from class Readable. I've also got a method
Code:
shared_ptr<Readable> ReadableFactory(istream &in);
which reads a file and returns an object of type A, B, or C depending on the file contents (or an empty shared_ptr if the file doesn't match any of them.)

But let's say that while A and B are similar and are used in many of the same parts of the code, C is very different, and shares only the fact that it a Readable with A and B. What's more, C has some dependencies that A and B don't have. I would thus prefer not to have code that only uses A and B depend on C.

However, any code that uses the ReadableFactory() method will have a linker dependency on C, of course. Thus any executable using it will have all of C's dependencies even if C is irrelevant to its functionality.

Is there some design pattern that can avoid this problem? I can't think of one, but it seems like there should be some way around it.