In that case, I would just use a SubsetRandomSampler based on the class indices.
Here is a small example getting the class indices for class0 from an ImageFolder dataset and creating the SubsetRandomSampler:
targets = torch.tensor(dataset.targets)
target_idx = (targets==0).nonzero()

sampler = torch.utils.data.sampler.SubsetRandomSampler(target_idx)

loader = DataLoader(
    dataset,
    sampler=sampler)

for data, target in loader:
    print(target)  # should only print zeros

You could create a member method inside CustomData to return the class indices and pass it to the sampler.